package com.openlab.callsystem.controller;

import com.openlab.callsystem.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.Map;

@Controller
public class PageController {
    @GetMapping("/tabledata")
    public String test3(){
        return "tables-data";
    }
    @GetMapping("/withdraw")
    public String test(){
        return "withdraw";
    }
    @GetMapping("/caller")
    public String test2(){
        return "caller";
    }
    @GetMapping("/callerData")
    public String test4(){
        return "callerData";
    }
    @GetMapping("/uicards")
    public String test5(){
        return "ui-cards";
    }
    @GetMapping("/windows")
    public String test6(){
        return "windows";
    }
    @GetMapping("/business")
    public String test7(){
        return "business";
    }
    @GetMapping("/callScreen")
    public String test8(){
        return "callScreen";
    }
    @GetMapping("/login")
    public String test9(){
        return "page-login";
    }
    @GetMapping("/register")
    public String test10(){
        return "page-register";
    }
    @Autowired
    LogService service;
    @GetMapping("/mainindex")
    public String mainindex(Model model){
        Map<String, Integer> indexData = service.getIndexData();
        for(String key:indexData.keySet()){
            model.addAttribute(key,indexData.get(key));
        }
        return "main-index";
    }
    @GetMapping("/charts")
    public String test12(){
        return "charts-chartjs";
    }
}
